package com.sky.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * 套餐菜品关系
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SetmealDish implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;

    //套餐id
    private Long setmealId;

    //菜品id
    private Long dishId;

    //菜品名称 （冗余字段）
    private String name;

    //菜品原价
    private BigDecimal price;

    //份数
    private Integer copies;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SetmealDish)) return false;
        SetmealDish that = (SetmealDish) o;
        return Objects.equals(getId(), that.getId()) && Objects.equals(getSetmealId(), that.getSetmealId()) && Objects.equals(getDishId(), that.getDishId()) && Objects.equals(getName(), that.getName()) && Objects.equals(getPrice(), that.getPrice()) && Objects.equals(getCopies(), that.getCopies());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getSetmealId(), getDishId(), getName(), getPrice(), getCopies());
    }
}
